package com.qiye.livevideo.controller;
import javax.annotation.Resource;

import com.qiye.livevideo.common.ResultInfo;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.LinkedHashMap;
import java.util.Map;
import org.springframework.stereotype.Controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.qiye.livevideo.model.AliCloudOssInfo;
import com.qiye.livevideo.service.AliCloudOssInfoService;


/**
 *阿里云oss相关配置信息 controller
 *  Created on 2019/4/30.
 *  @author meishijun
 */
@Api(description="阿里云oss相关配置信息")
@Controller
@RequestMapping(value = "/aliCloudOssInfo")
public class AliCloudOssInfoController  {


	@Resource
	private AliCloudOssInfoService aliCloudOssInfoService;
	/**
	 * 删除-阿里云oss相关配置信息
	 */
	@ResponseBody
	@RequestMapping("/deleteByPrimaryKey")
	@ApiOperation(value="根据主键删除", notes="参数只用到了主键id,其他参数忽略" ,httpMethod="POST")
	public ResultInfo deleteByPrimaryKey(Integer id, HttpServletRequest request, HttpServletResponse response){
		return ResultInfo.success(aliCloudOssInfoService.deleteByPrimaryKey(id));
	}


	/**
	 *  保存 (主键为空则增加否则修改)-> 阿里云oss相关配置信息
	 */
	@ResponseBody
	@RequestMapping("/save")
	@ApiOperation(value="保存", notes="主键为空则增加否则修改" ,httpMethod="POST")
	public ResultInfo save(AliCloudOssInfo aliCloudOssInfo,HttpServletRequest request,HttpServletResponse response){
		if(aliCloudOssInfo.getId()==null){
			return ResultInfo.success(aliCloudOssInfoService.insert(aliCloudOssInfo));
		}
		return ResultInfo.success(aliCloudOssInfoService.update(aliCloudOssInfo));

	}


	/**
	 * 根据主键查询->阿里云oss相关配置信息
	 */
	@ResponseBody
	@RequestMapping("/selectByPrimaryKey")
	@ApiOperation(value="根据主键查询", notes="参数只用到了主键." ,httpMethod="POST")
	public ResultInfo selectByPrimaryKey(Integer id,HttpServletRequest request,HttpServletResponse response){
		return ResultInfo.success(aliCloudOssInfoService.selectByPrimaryKey(id));
	}


	/**
	 * 根据条件查询(所有的实体属性都是条件,如果为空则忽略该字段)->阿里云oss相关配置信息
	 */
	@ResponseBody
	@RequestMapping("/selectByCondition")
	@ApiOperation(value="根据条件查询", notes="参数为空则忽略." ,httpMethod="POST")
	public ResultInfo selectByCondition(AliCloudOssInfo aliCloudOssInfo,HttpServletRequest request,HttpServletResponse response){
		return ResultInfo.success(aliCloudOssInfoService.selectByCondition(aliCloudOssInfo));
	}


	/**
	 * 分页查询 (所有的实体属性都是条件,如果为空则忽略该字段) ( 默认 page=1 pageSize=10)->阿里云oss相关配置信息
	 */
	@ResponseBody
	@RequestMapping("/selectAllByPaging")
	@ApiOperation(value="分页查询", notes="默认page=1pageSize等于10" ,httpMethod="POST")
	public ResultInfo selectAllByPaging(AliCloudOssInfo aliCloudOssInfo,HttpServletRequest request,HttpServletResponse response){
		return ResultInfo.success(aliCloudOssInfoService.selectAllByPaging(aliCloudOssInfo));
	}


}
